/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package Rada.Html;
import Rada.RObject;

/**
 *
 * @author Miguel
 */
public class Select extends RObject{
    String[][]data;
    public int field_id;
    public int field_value;
    public String title;
    public Select(){
        super();
        init();
    }
    public Select(String id){
        super(id);
        init();
    }
    public Select(String id, String[][] d){
        super(id);
        init();
        data = d;
    }
    public Select(String [][]d){
        super();
        init();
        data = d;
    }
    public void init(){
        field_id = 0;
        field_value = 1;
        title="";
    }
    @Override
    public String show(){
        html="<select ";
        html+=getProperties();
        html+=getEvents();
        html+=">";
        for (int i=0;i<data.length;i++){
            if (!title.isEmpty()){
                html+="<option >";
                html+=title;
                html+="</option>";
            }
            for (int j=0;j<data[j].length;j++){
                html+="<option id='";
                html+=data[i][field_id];
                html+=">";
                html+=data[i][field_value];
                html+="</option>";
            }
        }
        html+="</select>";
        return html;
    }
}